home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / thinkref / archive / THINKPascalUH2.1.sea / THINKPas Univ Hdr 2.1 / Interfaces / Serial.p < prev    next >
Text File  |  1995-09-12  |  4KB  |  154 lines

  1. { Converted with MPW2TPas Tuesday, September 12, 1995 9:55:07 PM }
  2. {
  3.      File:        Serial.p
  4.  
  5.      Contains:    Serial port Interfaces.
  6.  
  7.      Version:    Technology:    System 7.5
  8.                  Package:    Universal Interfaces 2.1 in “MPW Latest” on ETO #18
  9.  
  10.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  11.                  All rights reserved.
  12.  
  13.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  14.                  stack.  Include the file and version information (from above)
  15.                  in the problem description and send to:
  16.                      Internet:    apple.bugs@applelink.apple.com
  17.                      AppleLink:    APPLE.BUGS
  18.  
  19. }
  20.  
  21.  UNIT Serial;
  22.  INTERFACE
  23.  
  24.  
  25. {$IFC UNDEFINED __SERIAL__}
  26. {$SETC __SERIAL__ := 1}
  27.  
  28.   USES
  29.    ConditionalMacros, Types;
  30.  
  31. { $PUSH}
  32. { $ALIGN MAC68K}
  33. { $LibExport+}
  34.  
  35. CONST
  36.     baud300                        = 380;
  37.     baud600                        = 189;
  38.     baud1200                    = 94;
  39.     baud1800                    = 62;
  40.     baud2400                    = 46;
  41.     baud3600                    = 30;
  42.     baud4800                    = 22;
  43.     baud7200                    = 14;
  44.     baud9600                    = 10;
  45.     baud19200                    = 4;
  46.     baud38400                    = 1;
  47.     baud57600                    = 0;
  48.     stop10                        = 16384;
  49.     stop15                        = -32768;
  50.     stop20                        = -16384;
  51.     noParity                    = 0;
  52.     oddParity                    = 4096;
  53.     evenParity                    = 12288;
  54.     data5                        = 0;
  55.     data6                        = 2048;
  56.     data7                        = 1024;
  57.     data8                        = 3072;
  58.  
  59.     ctsEvent                    = 32;
  60.     breakEvent                    = 128;
  61.     xOffWasSent                    = 128;
  62.     dtrNegated                    = 64;
  63.     ainRefNum                    = -6;                            {serial port A input}
  64.     aoutRefNum                    = -7;                            {serial port A output}
  65.     binRefNum                    = -8;                            {serial port B input}
  66.     boutRefNum                    = -9;                            {serial port B output}
  67.     swOverrunErr                = 1;                            {serial driver error masks}
  68.     breakErr                    = 8;                            {serial driver error masks}
  69.     parityErr                    = 16;                            {serial driver error masks}
  70.     hwOverrunErr                = 32;                            {serial driver error masks}
  71.     framingErr                    = 64;                            {serial driver error masks}
  72.     serdOptionClockExternal        = $40;                            {option bit used with Control code 16}
  73.     serdOptionPreserveDTR        = $80;                            {option bit used with Control code 16}
  74.  
  75.     sPortA                        = 0;
  76.     sPortB                        = 1;
  77.  
  78.     
  79. TYPE
  80.     SPortSel = SInt8;
  81.  
  82. { csCodes for serial driver Control routines }
  83.  
  84. CONST
  85.     serdReset                    = 8;
  86.     serdSetBuf                    = 9;
  87.     serdHShake                    = 10;
  88.     serdClrBrk                    = 11;
  89.     serdSetBrk                    = 12;
  90.     serdSetBaud                    = 13;
  91.     serdHShakeDTR                = 14;
  92.     serdSetMIDI                    = 15;
  93.     serdSetMisc                    = 16;
  94.     serdSetDTR                    = 17;
  95.     serdClrDTR                    = 18;
  96.     serdSetPEChar                = 19;
  97.     serdSetPECharAlternate        = 20;
  98.     serdSetXOff                    = 21;
  99.     serdClrXOff                    = 22;
  100.     serdSendXOnConditional        = 23;
  101.     serdSendXOn                    = 24;
  102.     serdSendXOffConditional        = 25;
  103.     serdSendXOff                = 26;
  104.     serdChannelReset            = 27;
  105.     serdSet230KBaud                = 'JF';                            { set 230K baud data rate }
  106.     serdSetPollWrite            = 'jf';                            { disable interrupt-driven transmit }
  107.     serdSetFlushCount            = 'FC';
  108.  
  109. { csCodes for serial driver Status routines }
  110.     serdGetBuf                    = 2;
  111.     serdStatus                    = 8;
  112.     serdGetVers                    = 9;
  113.     serdGetVersSys                = $8000;
  114.  
  115.  
  116. TYPE
  117.     SerShk = PACKED RECORD
  118.         fXOn:                    Byte;                                    {XOn flow control enabled flag}
  119.         fCTS:                    Byte;                                    {CTS flow control enabled flag}
  120.         xOn:                    CHAR;                                    {XOn character}
  121.         xOff:                    CHAR;                                    {XOff character}
  122.         errs:                    Byte;                                    {errors mask bits}
  123.         evts:                    Byte;                                    {event enable mask bits}
  124.         fInX:                    Byte;                                    {Input flow control enabled flag}
  125.         fDTR:                    Byte;                                    {DTR input flow control flag}
  126.     END;
  127.  
  128.     SerStaRec = PACKED RECORD
  129.         cumErrs:                Byte;
  130.         xOffSent:                Byte;
  131.         rdPend:                    Byte;
  132.         wrPend:                    Byte;
  133.         ctsHold:                Byte;
  134.         xOffHold:                Byte;
  135.     END;
  136.  
  137.  
  138. FUNCTION SerReset(refNum: INTEGER; serConfig: INTEGER): OSErr;
  139. FUNCTION SerSetBuf(refNum: INTEGER; serBPtr: Ptr; serBLen: INTEGER): OSErr;
  140. FUNCTION SerHShake(refNum: INTEGER; {CONST}VAR flags: SerShk): OSErr;
  141. FUNCTION SerSetBrk(refNum: INTEGER): OSErr;
  142. FUNCTION SerClrBrk(refNum: INTEGER): OSErr;
  143. FUNCTION SerGetBuf(refNum: INTEGER; VAR count: LONGINT): OSErr;
  144. FUNCTION SerStatus(refNum: INTEGER; VAR serSta: SerStaRec): OSErr;
  145.  
  146. { $ALIGN RESET}
  147. { $POP}
  148.  
  149. {$ENDC} {__SERIAL__}
  150.  
  151.  IMPLEMENTATION
  152.  END.
  153.  
  154.